package de.shb.util.presentation;

import java.io.Serializable;
import java.sql.SQLException;
import java.util.ArrayList;

import de.shb.signature.business.SignaturBusiness;
import de.shb.signature.dao.SignaturBean;

public class InputController implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	InputPresentationClient inputBusiness = SignaturBusiness.getInstance();

	public boolean add(int id, String commiter, String owner, String comment,
			String signature) {

		if (commiter == "" || owner == "" || comment == "" || signature == "")
			return false;

		SignaturBean neuInput;
		try {
			neuInput = inputBusiness.createInput(commiter, owner, comment,
					signature);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		}
		if (neuInput != null)
			return true;
		return false;
	}

	public ArrayList<SignaturBean> getAllNew() {
		try {
			return inputBusiness.findAllInput();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return new ArrayList<SignaturBean>();
		}
	}

	public ArrayList<SignaturBean> getAllAgreed() {
		try {
			return inputBusiness.findAllInput();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return new ArrayList<SignaturBean>();
		}
	}
}
